package com.cz.design.structure.adapter.obj;

import com.cz.design.structure.adapter.Player;
import com.cz.design.structure.adapter.Translator;
import com.cz.design.structure.adapter.Zh_JPTranslator;

/**
 * 组合的方式：对象结构模型，适配转换到了翻译器的功能上
 */
public class JPMoviePlayerAdapter implements Player {

    // 组合的方式
    private Translator translator = new Zh_JPTranslator();

    private Player target; // 被适配对象

    public JPMoviePlayerAdapter(Player target) {
        this.target = target;
    }

    @Override
    public String play() {
        String play = target.play();
        String translate = translator.translator(play);
        System.out.println("日文：" + translate);
        return play;

    }
}
